package de.barny.gui;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;

import de.barny.prefs.ResourceBundleHelper;

public class SnakeFrame extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	GameField gField = new GameField();
	
	final static String GAMEFIELD = "GameField Card";
	
	public SnakeFrame() {
		setTitle(getResource("application.title"));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setResizable(false);
		
		getContentPane().setPreferredSize(new Dimension(Integer.parseInt(getResource("window.size.width")), Integer.parseInt(getResource("window.size.height"))));
		pack();
		
		setLocation(Toolkit.getDefaultToolkit().getScreenSize().width/2 - getSize().width/2, Toolkit.getDefaultToolkit().getScreenSize().height/2 - getSize().height/2);
		addComponents(getContentPane());
	}

	private void addComponents(Container content) {
		JPanel cards = new JPanel();
		
		cards.add(gField, GAMEFIELD);
		
		content.add(gField);
	}
	
	private String getResource(String a_strResourceKey) {
		return ResourceBundleHelper.getResource(a_strResourceKey);
	}

}
